Computers are used in many applications. As computing systems continue to evolve, the graphical display characteristics of these computing systems become more and more advanced. As more advanced graphical display systems are created, the visual effects that these systems are able to achieve are increasingly complex. In many cases the graphical displays attempt to approximate real-world visual effects. This can be problematic, as some real-world phenomena do not map easily to a digital processing system.
One example is an attempt to achieve nonlinear functions in a graphical display. An example of such a nonlinear function is the attempt to simulate fogging effects on a graphical display. In order to simulate a fogging effect, images that are drawn with the intent to appear closer to the viewer are clearer than those in the distance. Fog is typically simulated through an exponential function that causes images to be increasingly blurred or "grayed-out" exponentially as they fade into the distance. Thus, the weight of the fog or the amount of contribution that the fog provides for images that are close to the viewer is small, whereas the weight increases exponentially as the fade into the distance.
Triangles or other primitives are often used in graphics systems to generate images. Typically, these graphics primitives only include a limited set of values for the different parameters that describe the primitive. In most cases, the limited set of values corresponds to the vertices of the primitive. Therefore, a triangle primitive will contain three sets of values, one at each vertex of the triangle. The values at each vertex will represent a value for a particular parameter at that vertex. In order to determine the value of a parameter at a point between the vertices, a linear interpolation is typically performed based on the values at each of the vertexes. Because this interpolation is performed in a linear fashion, it is very difficult to simulate exponential or other nonlinear functions, such as those required to accurately simulate a fogging effect.
The problems associated with attempting to simulate exponential and other nonlinear functions using the linear interpolation performed within graphics primitives becomes increasingly problematic in large primitives. This is because the variation or gradient of the particular parameter may be substantial across such a large primitive. In such cases, the linear approximation produced through linear interpolation may significantly diverge from the ideal nonlinear function.
A potential solution to the problem of approximating nonlinear functions within a graphics primitive is to perform a nonlinear calculation based on the nonlinear function each time a value is required. However, this solution is impractical, as the time required to perform the many complex nonlinear calculations would have a detrimental effect on the performance of the overall graphics system.
Therefore, a need exists for a method and apparatus that allow exponential and other nonlinear functions to be accurately and efficiently approximated in a graphics system.